package com.example.demo.controller;

import com.example.demo.entity.UserEntity;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 郭峪诚
 * @version 1.0.0
 * @ClassName UserController.java
 * @Description TODO
 * @createTime 2021年03月09日 15:42:00
 */
@Controller
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/index")
    @ResponseBody
    public String index(String name){
        return "你好"+name;
    }

    @RequestMapping("/")
    public String index1(){
        return "index1";
    }

    @RequestMapping("getList")
    @ResponseBody
    public List<UserEntity> getList(){
        return userService.getList();
    }
}
